<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@include file="../../../common/common.jsp" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title>云众科技网上预约挂号系统</title>
    <%--<style type="text/css">--%>
    <%--.sty {--%>
    <%--width: 20px;--%>
    <%--height: 20px;--%>
    <%--border: 0px;--%>
    <%--}--%>
    <%--</style>--%>
</head>

<body>
<div class="main-container" id="main-container">
    <!-- /section:basics/sidebar -->
    <div class="main-content">
        <div class="main-content-inner">
            <div class="page-content">
                <div class="row">
                    <div class="col-xs-12">

                        <!-- 检索  -->
                        <form method="post" name="infoForm" action="/baseinfo/showHospitalInfo">
                            <div class="container">
                                <div class="col-sm-4" style="margin-top: 20px;">
                                    <div class="input-group">
                                        <input type="text" class="form-control" autocomplete="off" name="hospitalName"
                                               placeholder="请输入医院名称" value="${pd.hospitalName }">
                                        <div class="input-group-btn">
                                            <button type="button" class="btn btn-warning" onclick="doSearch()"><span
                                                    class="glyphicon glyphicon-search"></span></button>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-sm-6"></div>
                                <div class="col-sm-2" style="margin-top: 20px;">
                                    <div class="form-group">
                                    </div>
                                </div>
                            </div>
                            <table id="simple-table" class="table table-striped table-hover" style="margin-top:5px;">
                                <thead>
                                <tr class="bg-primary">
                                    <td align="center"><a href="javascript:selectAll()"><font
                                            style="color: white;">全选</font></a></td>
                                    <td align="center">序号</td>
                                    <td align="center">医院名称</td>
                                    <td align="center">医院简介</td>
                                    <td align="center">首页图片</td>
                                    <td align="center">操作</td>
                                </tr>
                                </thead>

                                <tbody>
                                <!-- 开始循环 -->
                                <c:choose>
                                    <c:when test="${not empty page.list}">
                                        <c:forEach items="${page.list}" var="host" varStatus="i">
                                            <tr>
                                                <td align="center"><input type="checkbox" name="ids"
                                                                          value="${host.hospitalId}"></td>
                                                <td align="center">${(page.pageNum-1)*page.pageSize+i.count}</td>
                                                <td align="center">${host.hospitalName}</td>
                                                <td align="center">${host.hospitalInfo}</td>
                                                <td align="center">${host.hospitalPic}</td>
                                                <td align="center">
                                                    <button type="button" class="btn btn-primary" title="修改"
                                                            onclick="editpage('${host.hospitalId}')"><span
                                                            class="glyphicon glyphicon-edit"></span></button>
                                                </td>
                                            </tr>
                                        </c:forEach>
                                    </c:when>
                                    <c:otherwise>
                                        <tr class="main_info">
                                            <td colspan="100" class="center">没有相关数据</td>
                                        </tr>
                                    </c:otherwise>
                                </c:choose>
                                </tbody>
                            </table>
                            <div align="center">
                                <yzpage:page pageName="page" url="/baseinfo/showHospitalInfo"></yzpage:page>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script type="text/javascript">
    // 跳转修改页面
    function editpage(id) {
        location.href = "/baseinfo/editshowHospitalInfo?id=" + id + "&pageNum=${pd.pageNum}";
    }

    // 条件查询方法
    function doSearch() {
        $("form[name='infoForm']").attr("action", "/baseinfo/showHospitalInfo");
        $("form[name='infoForm']").submit();
    }

    //全选
    function selectAll() {
        var ipts;
        if ("${page!=null}" == "true") {
            inpts = $("form[name='departmentForm'] input[name='ids']");
        } else {
            inpts = $("form[name='departmentTypeForm'] input[name='ids']");
        }
        var inpts = $("input[name='ids']");
        for (var i = 0; i < inpts.length; i++) {
            if (inpts[i].checked != true) {
                inpts[i].checked = true;
            } else {
                inpts[i].checked = false;
            }
        }
    }

    //批量操作
    function del() {
        bootbox.confirm("'确定要删除选中的数据吗?", function (result) {
            if (result) {
                var checked = $("form[name='infoForm'] :input:checked");

                if (checked.length == 0) {
                    bootbox.dialog({
                        message: "<span class='bigger-110'>您没有选择任何内容!</span>",
                        buttons:
                            {"button": {"label": "确定", "className": "btn-sm btn-success"}}
                    });
                    $("#zcheckbox").tips({
                        side: 1,
                        msg: '点这里全选',
                        bg: '#AE81FF',
                        time: 8
                    });
                    return;
                } else {
                    $("form[name='infoForm']").attr("action", "/baseinfo/removeshowHospitalInfo");
                    $("form[name='infoForm']").submit();
                }
            }
        });
    };
</script>
</html>

